package ArrayList; /**
 * Created with IntelliJ IDEA.
 * Description:
 * User: adol book
 * Date: 2022-04-24
 * Time: 8:18
 */

/**
 *
 *
 */
class fun<T>{
    //public Object[] array = new Object [5];
    public T[] array = (T[]) new Object[10] ;
    public T getpos(int pos){
        return array[pos];
    }
    public void setpos(T sun,int pos){
         array[pos] = sun;
    }
}
public class Demo {
    public static void main(String[] args) {
        fun <Integer>val = new fun<Integer>();
        val.setpos(9,1);
        fun<String>val1 = new fun<String>();
        val1.setpos("wch",0);
        Integer s = val.getpos(1);
        String s1 = val1.getpos(0);
       // String s1 =(String) val.getpos(0); //必须强转
       // int t = (int)val.getpos(1);
        System.out.println(s);
        System.out.println(s1);

    }
}
